/*
 * This file is part of Xer.
 *
 * Simple interpreter for the X language
 * Copyright (C)  Michael Morckos 2009 <mikey.morckos@gmail.com>
 *
 * Xer is free software: you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Xer is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with Xer.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef _X_parser_
#define _X_parser_

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <pthread.h>
#include "token.h"

/**** LEXER ****/
char		currlexem[1024],
			currC, 
			tmp;
int			pointer,
			linecount,
			tokencount,
			num;
unsigned char 	errflag,
				lexerflag,
				lexerdone,
				globalflag,
				globalcount;
extern FILE		*input_file,
				*output_lexer, 
				*output_parser;

Token			*symbol_table;

void init(void);
void flushlexem(void);
unsigned char matchtoken(char*);
void update_symbol_table(void);
void scan(void);
void shift();
void error(unsigned char);

/**** PARSER ****/

pthread_t	thread;
int			thread_status;

extern FILE		*output_parser;
int				stmtcount;

void prg();
void expr();
void compr();
void arith();
void term();
void prim();
void nofunccall();
void args();
void params();
void binds();

void monitor();
void togglethread();
unsigned char helper(unsigned char);

#endif

